﻿<%@ Control Language="c#" Inherits="TTQT.Administration.HorizontalMenu" CodeFile="HorizontalMenu.ascx.cs" %>
<%@ Import namespace="TTQT.TTQT_Code.Info"%>
<script runat="server">
	public void addParentMenu(string menuName, int menuId)
	{
		//stm_aix("","p0i0",[0,"Tên menu","","",-1,-1,0,"Default.aspx?pageId=1","_self","","","Administration/Menu/logoBIDV.png","Administration/Menu/logoBIDV.png",15,15,0,"Administration/Menu/0604arroldw.gif","Administration/Menu/0604arroldw.gif",9,7,0,1,1,"#B3CAE2",0,"#B3CAE2",0,"","",0,0,0,0,"#009999","#50647f"],100,20);
		Response.Write("\nstm_aix(\"\",\"p0i0\",[0,\""+menuName+"\",\"\",\"\",-1,-1,0,\""+"#"+"\",\"_self\",\"\",\"\",\""+"Administration/Menu/logoBIDV.png\",\""+"Administration/Menu/logoBIDV.png\",15,15,0,\""+"Administration/Menu/0604arroldw.gif\",\""+"Administration/Menu/0604arroldw.gif\",9,7,0,1,1,\"#B3CAE2\",0,\"#B3CAE2\",0,\"\",\"\",0,0,0,0,\"#009999\",\"#50647f\"],100,20);");
		//stm_bp("",[1,4,0,3,0,4,15,0,100,"",-2,"",-2,48,2,3,"#999999","transparent","",0,0,0,"#333333"]);
		Response.Write("\nstm_bp(\"\",[1,4,0,3,0,4,15,0,100,\"\",-2,\"\",-2,48,2,3,\"#999999\",\"transparent\",\"\",0,0,0,\"#333333\"]);");
	}
	
	public void addChildMenu(string menuName, int menuId)
	{
		//stm_aix("","p0i0",[0,"DS Người sử dụng","","",-1,-1,0,"Default.aspx?pageId=3","_self","","","Administration/Menu/logoBIDV.png","Administration/Menu/logoBIDV.png",15,15,0,"","",0,0,0,0,1,"#B3CAE2",0,"#7a8c9e",0,"","",3,3,0,0,"#7A8C9E","#CCCC00","#000000","#FFFFFF","10pt Arial","10pt Arial"],150,20);
		Response.Write("\nstm_aix(\"\",\"p0i0\",[0,\""+ menuName+"\",\"\",\"\",-1,-1,0,\"" +"Default.aspx?pageId="+menuId.ToString()+"\",\"_self\",\"\",\"\",\""+"Administration/Menu/logoBIDV.png\",\"" +"Administration/Menu/logoBIDV.png\",15,15,0,\"\",\"\",0,0,0,0,1,\"#B3CAE2\",0,\"#7a8c9e\",0,\"\",\"\",3,3,0,0,\"#7A8C9E\",\"#CCCC00\",\"#000000\",\"#FFFFFF\",\"10pt Arial\",\"10pt Arial\"],200,20);");
		// Chen dau gach ngang giua 2 menu con
		//stm_ai("",[6,1,"#50647f","",-1,-1,0]);
		Response.Write("stm_ai(\"\",[6,1,\"#50647f\",\"\",-1,-1,0]);stm_ai(\"\",[6,1,\"#50647f\",\"\",-1,-1,0]);");
	}
</script>
<%
	
	//Bat dau menu
	Response.ContentType = "Text/Html";
	Response.Write("\n<script type=\"text/javascript\" src='"+"Administration/Menu/stmenu.js'> </script>");
	Response.Write("\n<script type=\"text/javascript\">");
	Response.Write("\nstm_bm([\"menu0244\",810,\"\",\""+ "Administration/Menu/blank.gif\",0,\"\",\"\",0,0,250,0,20,1,0,0,\"\",\"\",0,0,1,1,\"default\",\"hand\",\"\"],this);");
	Response.Write("\nstm_bp(\"p0\",[0,4,0,0,3,3,15,9,100,\"\",-2,\"\",-2,90,0,0,\"#000000\",\"#7a8c9e\",\"\",0,0,0,\"#CCCCCC\"]);");
	
	//In ra cac menu khac
	try
	{
		if(Session["UserId"]!=null)
		{
            UserInfo userInfo = TTQT.TTQT_Code.DataAccessObject.instance().getUser(TTQT.TTQT_Code.TTQTCommon.ToInt32(Session["UserId"].ToString(), -1));
			ArrayList listCmd;
			if(userInfo.isSuperAdmin.Equals("1"))
			{
                listCmd = TTQT.TTQT_Code.DataAccessObject.instance().getAllMenu();
			}
			else
			{
                listCmd = TTQT.TTQT_Code.DataAccessObject.instance().GetArrayCmdsByUser_Id(userInfo.userId);
			}
			for(int i =0;i<listCmd.Count;i++)
			{
				CmdInfo cmd=(CmdInfo)listCmd[i];
				if(cmd.Cmd_Parent_Id==0)
				{
					// In ra dòng bắt đầu một menu cha mới.
					if(i>0) Response.Write("stm_ep();");
					addParentMenu(cmd.Cmd_Name,cmd.Cmd_Id);
				}
				else
					addChildMenu(cmd.Cmd_Name,cmd.Cmd_Id);	
			}
		}
	}catch(Exception ex)
	{
		//string err=ex.ToString();
		//Response.Write(err);
	}
	Response.Write("\nstm_em();");
	Response.Write("\n</script>");
		
%>
